Skip to content

fix: don't resend non-read commands over MQTT after a local timeout - #1027

Open
art804 wants to merge 1 commit into
Python-roborock:mainfrom
art804:fix/no-mqtt-resend-after-local-timeout
Open

art804 wants to merge 1 commit into
Python-roborock:mainfrom
art804:fix/no-mqtt-resend-after-local-timeout

Conversation

@art804

@art804 art804 commented Nov 10, 2026

Copy link
Copy Markdown

When a V1 command times out on the local channel, RpcChannel.send_command retries it over MQTT. By then the request has already been published, so the device may have received and run it. For a write (app_start, set_*, save_map, ...) the retry can make the device act twice. I saw the local-timeout-then-MQTT resend live on a Saros 20 with get_prop.

Change:

  • _send_rpc raises RoborockTimeout (a RoborockException subclass, so existing callers are unaffected) instead of a plain RoborockException.
  • After a timeout, only read-only commands (get_*, app_get_*) fall back to the next channel. Other commands raise RoborockTimeout.
  • Failures before publish (not connected, publish error) still fall back as before.

Tests: a parametrised case in tests/devices/rpc/test_v1_channel.py covers both paths. The write case fails without the change. The rest of the suite is unchanged, and ruff, mypy and codespell pass.

AI disclosure: this change was found and written with Claude (Anthropic's AI assistant), then tested before submitting.

🤖 Generated with Claude Code

A V1 command that timed out on the local channel was retried over MQTT. By then the
request had already been published, so the device may have received and run it, and
the retry could run a write command (start, set, save map) twice. Only read-only
commands (get_*, app_get_*) are now retried after a timeout; others raise
RoborockTimeout. Failures before publish still fall back as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant